platform_setup(cmdline_p);
paging_init();
+#ifdef CONFIG_XEN
contiguous_bitmap_init(max_pfn);
+#endif
}
/*
#define flush_agp_cache() mb()
/* Convert a physical address to an address suitable for the GART. */
+#ifndef CONFIG_XEN
+#define phys_to_gart(x) (x)
+#define gart_to_phys(x) (x)
+#else
#define phys_to_gart(x) phys_to_machine_for_dma(x)
#define gart_to_phys(x) machine_to_phys_for_dma(x)
+#endif
/* GATT allocation. Returns/accepts GATT kernel virtual address. */
+#ifndef CONFIG_XEN
+#define alloc_gatt_pages(order) \
+ ((char *)__get_free_pages(GFP_KERNEL, (order)))
+#define free_gatt_pages(table, order) \
+ free_pages((unsigned long)(table), (order))
+#else
#include <asm/hypervisor.h>
static inline char*
alloc_gatt_pages(unsigned int order)
xen_destroy_contiguous_region((unsigned long)table, order);
free_pages((unsigned long)table, order);
}
+#endif /* CONFIG_XEN */
#endif /* _ASM_IA64_AGP_H */
*/
#include <linux/config.h>
#include <asm/machvec.h>
+#ifdef CONFIG_XEN
/* Needed for arch/i386/kernel/swiotlb.c and arch/i386/kernel/pci-dma-xen.c */
#include <asm/hypervisor.h>
/* Needed for arch/i386/kernel/swiotlb.c */
#include <asm-i386/mach-xen/asm/swiotlb.h>
-
+#endif
+
+#ifndef CONFIG_XEN
+#define dma_alloc_coherent platform_dma_alloc_coherent
+#define dma_alloc_noncoherent platform_dma_alloc_coherent /* coherent mem. is cheap */
+#define dma_free_coherent platform_dma_free_coherent
+#define dma_free_noncoherent platform_dma_free_coherent
+#define dma_map_single platform_dma_map_single
+#define dma_map_sg platform_dma_map_sg
+#define dma_unmap_single platform_dma_unmap_single
+#define dma_unmap_sg platform_dma_unmap_sg
+#define dma_sync_single_for_cpu platform_dma_sync_single_for_cpu
+#define dma_sync_sg_for_cpu platform_dma_sync_sg_for_cpu
+#define dma_sync_single_for_device platform_dma_sync_single_for_device
+#define dma_sync_sg_for_device platform_dma_sync_sg_for_device
+#define dma_mapping_error platform_dma_mapping_error
+#else
int dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
enum dma_data_direction direction);
void dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
swiotlb_sync_sg_for_device(dev,sg,nelems,direction);
flush_write_buffers();
}
+#endif
#define dma_map_page(dev, pg, off, size, dir) \
dma_map_single(dev, page_address(pg) + (off), (size), (dir))
#define dma_is_consistent(dma_handle) (1) /* all we do is coherent memory... */
+#ifdef CONFIG_XEN
/* arch/i386/kernel/swiotlb.o requires */
void contiguous_bitmap_init(unsigned long end_pfn);
return (((((unsigned long)p & ~PAGE_MASK) + size) > PAGE_SIZE) &&
!test_bit(__pa(p) >> PAGE_SHIFT, contiguous_bitmap));
}
+#endif
#endif /* _ASM_IA64_DMA_MAPPING_H */
* The following two macros are deprecated and scheduled for removal.
* Please use the PCI-DMA interface defined in <asm/pci.h> instead.
*/
+#ifndef CONFIG_XEN
+#define bus_to_virt phys_to_virt
+#define virt_to_bus virt_to_phys
+#define page_to_bus page_to_phys
+#else
#define bus_to_virt(bus) \
phys_to_virt(machine_to_phys_for_dma(bus))
#define virt_to_bus(virt) \
(((bvec_to_bus((vec1)) + (vec1)->bv_len) == bvec_to_bus((vec2))) && \
((bvec_to_pseudophys((vec1)) + (vec1)->bv_len) == \
bvec_to_pseudophys((vec2))))
+#endif /* CONFIG_XEN */
# endif /* KERNEL */
# error Unknown configuration. Update asm-ia64/machvec.h.
# endif /* CONFIG_IA64_GENERIC */
+#ifdef CONFIG_XEN
# define platform_dma_map_sg dma_map_sg
# define platform_dma_unmap_sg dma_unmap_sg
# define platform_dma_mapping_error dma_mapping_error
dma_sync_single_for_cpu
# define platform_dma_sync_single_for_device \
dma_sync_single_for_device
+#endif
/*
* Declare default routines which aren't declared anywhere else:
# define pfn_to_page(pfn) (vmem_map + (pfn))
#endif
+#ifndef CONFIG_XEN
+#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
+#endif
#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
static inline void
pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, struct page *pte)
{
+#ifndef CONFIG_XEN
+ pmd_val(*pmd_entry) = page_to_phys(pte);
+#else
pmd_val(*pmd_entry) = page_to_pseudophys(pte);
+#endif
}
static inline void